
<template>
	<!-- 添加每周食谱 -->
	<div>
		<el-row>
			<el-col :span="4">
				<span class="formLable must">食谱适用日期</span>
			</el-col>
			<el-col :span="10">
				<weekPicker @callback="pickTime"></weekPicker>
			</el-col>
		</el-row>

		<el-row>
			<el-col :span="4">
				<span class="formLable must">食谱照片</span>
			</el-col>
			<el-col :span="20">
				<imageUpload :type="'image'" :maxSize="2" v-model="imageUrl"></imageUpload>
			</el-col>
		</el-row>
		
		<el-row style="text-align:center;">
			<el-button @click="cancle">关闭</el-button>
			<el-button @click="save">提交</el-button>
		</el-row>
	</div>
</template>

<script>
	let vm;
	import imageUpload from '@/components/common/image_upload'
	import weekPicker from '@keer/components/common/week_picker'
	export default{
		components:{imageUpload,weekPicker},
		data(){
			return {
				startTime:'',
				endTime:'',
				imageUrl:[],
			}
		},
		methods:{
			init(data){
				this.startTime='';
				this.endTime='';
				this.imageUrl='';
				if(data){
					this.startTime='';
					this.endTime='';
					this.imageUrl='';
				}
			},
			pickTime(data){
				this.startTime=data[0];
				this.endTime=data[1];
			},
			cancle(){
				this.$emit('cancle',false);
			},
			save(){
				if(!this.imageUrl||this.imageUrl.length==0){
					this.$message({
						type:'warning',
						message:'请上传食谱照片！'
					})
					return;
				}

				this.$emit('cancle',false);
			},
		},
		mounted(){
			vm=this;
		},
		computed:{
			
		},
		watch:{

		}
	}
</script>

<style lang="scss" scoped>
	.formLable,.formValue{
		font-size: 0.16rem;
		line-height: 0.4rem;
	}
	.formLable.must::before{
		content: '*';
		color: red;
		margin: 0 0.05rem;
	}
	.el-row{
		margin-bottom: 0.16rem;
	}
	.el-checkbox{
		font-size: 0.16rem;
		line-height: 0.4rem;
	}
</style>